package com.dream.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public static String formateTime(long time){
        Date date = new Date();
        date.setTime(time);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return dateFormat.format(date);
    }
    public static String formateLong2String(String date){
        try {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            Date d = dateFormat.parse(date);
            return String.valueOf(d.getTime());
        }catch (Exception e){
            e.printStackTrace();
            return "";
        }
    }
}
